import Vue from 'vue'
import 'cropperjs/dist/cropper.css'
import './plugins/axios'
import './plugins/muse'
import App from './App.vue'
import router from './router'
import store from './store'
import { exportApi } from '@/api'

const debug = process.env.NODE_ENV === 'development'
Vue.config.devtools = debug
Vue.config.productionTip = debug

function boot(debug = false) {
  store.dispatch('initialize')
  new Vue({
    router,
    store,
    render: h => h(App)
  }).$mount('#app')
  if (debug) {
    exportApi(false)
  }
  window._export_api = exportApi
}

if (window.cordova) {
  document.addEventListener('deviceready', () => {
    boot(debug)
  }, false)
} else {
  boot(debug)
}
